Java.perform(function () {

    var Cipher = Java.use("javax.crypto.Cipher");
    var IvParameterSpec = Java.use("javax.crypto.spec.IvParameterSpec");

    Cipher.getInstance.overload('java.lang.String').implementation = function (arg) {
        console.log("instance=", arg);
        return this.getInstance(arg);
    }

    Cipher.init.overload('int', 'java.security.Key', 'java.security.spec.AlgorithmParameterSpec').implementation = function (mode, key, iv) {
        console.log("-----------------------Cipher.init---------------------------");
        console.log("Cipher.init=", mode, key, iv);
        console.log("Cipher.key=", key.getEncoded());
        //console.log("Cipher.init=",JSON.stringify(iv));
        console.log("Cipher.iv=", Java.cast(iv, IvParameterSpec).getIV());
        this.init(mode, key, iv);
    }

});

// frida -U -f  com.achievo.vipshop -l  hook.js
// frida -UF -l hook.js
